package com.learn.spring.boot.config.springbootconfig.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class ValueCommandLineRunner implements CommandLineRunner {

    private static final Logger logger = LoggerFactory.getLogger(ValueCommandLineRunner.class);

    @Value("${value.max-threads}")
    private Integer maxThreads;
    @Value("${value.connect-timeout}")
    private Integer connectTimeOut;
    @Value("${value.name}")
    private String name;
    @Autowired
    private NioEndpointProperties nioEndpointProperties;
    @Value("${dubboTest}")
    private String dubboTest;

    @Override
    public void run(String... args) throws Exception {
        logger.info("maxThreads: " + maxThreads + ", connectTimeOut: " + connectTimeOut + ", name: " + name);
        logger.info("dubboTest: " + dubboTest);
        logger.info(nioEndpointProperties.toString());
    }
}
